package com.sqy.controller;


import com.sqy.entity.Banner;
import com.sqy.exception.ImoocMallExceptionEnum;
import com.sqy.service.BannerService;
import com.sqy.utlis.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Banner")
@Api(tags = "首页轮播图")
public class BannerController {

   @Autowired
    BannerService  bannerService;

    @PostMapping("/add")
    @ApiOperation("添加轮播图")
    public ApiResult AddBanner(@RequestBody Banner banner){

        boolean save = bannerService.save(banner);

        if(save){
            return  ApiResult.success();
        }
       return  ApiResult.error(ImoocMallExceptionEnum.ADD_FAIL);
    }

}
